package methods

import "fmt"

func Panic_recover() {
	defer func() {
		err := recover()
		if err != nil {
			fmt.Println("发生错误啦")
			fmt.Println(err)
		}
	}()
	panic("假装错误")
}

func Try(body func(), except func(interface{})) {
	defer func() {
		err := recover()
		if err != nil {
			except(err)
		}
	}()

	body()
}
